﻿using System;
using RabbitMQClient;

namespace RabbitMQSubscribePublish
{
    class Program
    {
        static void Main(string[] args)
        {
            RabbitMQClient.IRabbitMQClient client = new RabbitMQClient.RabbitMQClient(
                host: "localhost",
                port: 5672,
                userName: "root",
                passowrd: "123456"
            );

            for (int i = 0; i < 20; i++)
            {
                Message message = new Message()
                {
                    a = i.ToString(),
                    b = "a" + i
                };
                Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(message));
                client.Publish<Message>(message, "logs");
            }

            Console.WriteLine("数据发送完成");
            Console.ReadLine();
        }
    }
}
